import React from 'react';
import { Modal as SemiModal } from '@douyinfe/semi-ui';
import { ModalReactProps } from '@douyinfe/semi-ui/modal';

import { DialogBasicProps, DialogInstance } from '@shared/components/Dialog';

export type AdminDialogProps = ModalReactProps & DialogBasicProps;

const AdminDialogInstance: DialogInstance<AdminDialogProps> = {
    confirm(props: AdminDialogProps) {
        props.maskClosable = false;
        props.closable = false;
        SemiModal.confirm(props);
    },
    
    alert(props: AdminDialogProps) {
        props.maskClosable = false;
        props.closable = false;
        props.cancelButtonProps = {
            style: { display: 'none' },
        }
        SemiModal.confirm(props);
    },

    info(props: AdminDialogProps) {
        SemiModal.info(props);
    },

    success(props: AdminDialogProps) {
        SemiModal.success(props);
    },

    error(props: AdminDialogProps) {
        SemiModal.error(props);
    },

    warn(props: AdminDialogProps) {
        SemiModal.warning(props);
    },
};

export const Modal = SemiModal;

export default AdminDialogInstance;
